package com.example.shopping.controller;
import com.example.shopping.entity.GoodsCategory;
import com.example.shopping.service.GoodsCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;

/**
 * @author xuan 2021/9/16
 */
@Controller
public class GoodsCategoryController {
   @Autowired
   GoodsCategoryService goodsCategoryService;

   @RequestMapping(value = "/showGoodsAll", method = {RequestMethod.GET})
   @ResponseBody
   public List<GoodsCategory> showGoodsAll() {
      return goodsCategoryService.showGoodsAll();
   }

   @RequestMapping(value = "/showCategoryAll", method = RequestMethod.POST)
   @ResponseBody
   public GoodsCategory showCategoryAll(@RequestParam String categoryName) {
      return goodsCategoryService.showCategoryAll(categoryName);
   }
}
